package org.example;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    /*public static void main(String[] args) {
//        Boolean flag = false;
//        String res = String.valueOf("12321");
//        System.out.println(res.charAt(4));
//        System.out.println(res.charAt(0));
//        System.out.println(res.charAt(3));
//        System.out.println(res.charAt(2));
//        if(res.charAt(4)==res.charAt(0)&&res.charAt(3)==res.charAt(1)){
//            System.out.println("hello");
//            flag = true;
//        }
//        System.out.println(flag);
        String res = "123";
        Pattern pattern = Pattern.compile("[0-9]");
        Matcher matcher = pattern.matcher(res);
        while (matcher.find()){
            System.out.println("find");
        }
    }*/

    public static void main(String[] args) {
        HashMap<String,String> map = new HashMap<>();
        map.put("hello","world");
        map.put("world","hello");
        /*Set<String> key = map.keySet();
        for(String keyStr : key){
            System.out.println("key="+keyStr+",value="+map.get(keyStr));
        }*/

        map.forEach((keys,value)->{
            System.out.println("key="+keys+",value="+value);
        });
        /*Set<Map.Entry<String, String>> entries = map.entrySet();
        for(Map.Entry<String, String> entry : entries){
            entry.getKey()
        }*/
        Set ss = new HashSet<>();
        ss.add(1);
        ss.add(2);
        System.out.println();
        System.out.println();

        ss.forEach((res)->{
            System.out.println("结果为："+res);
        });

        for(int i=0;i<ss.size();i++){
            System.out.println("集合结果:"+ss);
        }

        int[] res = {2,3,4};
        for(int i=0;i<res.length;i++){
            System.out.println(res[i]);
        }
        String testStr = "hekhe";
        for(int i=0;i<testStr.length();i++){
            System.out.println(testStr.charAt(i));
        }
        System.out.println(testStr.matches("[a-zA-Z]+"));


    }
}